﻿<UserControl x:Class="ModernAudioTagger.Content.ContentEditAudioTagVertical"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:provider="clr-namespace:ModernAudioTagger.Provider"
             xmlns:converter="clr-namespace:ModernAudioTagger.Converter"
             xmlns:mscorlib="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="300">

    <UserControl.DataContext>
        <Binding Source="{x:Static provider:ViewModelLocator.Instance}" Path="LocalSystemVM" />
    </UserControl.DataContext>

    <UserControl.Resources>
        <mscorlib:Double x:Key="text_width">200</mscorlib:Double>
        <converter:ArraySplitConverter x:Key="arraysplitConverter" />
        <converter:IsEqualOrGreaterThanConverter x:Key="isEqualOrGreaterThanConverter" />
        <converter:ImageConverter x:Key="imageConverter" />
        <mscorlib:Double x:Key="textbox_height">20</mscorlib:Double>
        <mscorlib:Double x:Key="cover_size">96</mscorlib:Double>

        <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}" x:Key="singleSelectionCheckbox">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Source={x:Static provider:ViewModelLocator.Instance}, Path=LocalSystemVM.SelectedFiles.Count, Converter={StaticResource isEqualOrGreaterThanConverter}, ConverterParameter=2, UpdateSourceTrigger=PropertyChanged}" Value="True">
                    <Setter Property="Visibility" Value="Hidden" />
                </DataTrigger>
            </Style.Triggers>
        </Style>


    </UserControl.Resources>

    <ScrollViewer>
        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Top">

            <!-- message is frozen -->
            <Border
                Margin="{StaticResource DefaultMargin}"
                BorderThickness="1"
                BorderBrush="{DynamicResource SeparatorBackground}"
                >
                <Border.Style>
                    <Style TargetType="{x:Type Border}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsPanelFrozen}" Value="True">
                                <Setter Property="Visibility" Value="Visible" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsPanelFrozen}" Value="False">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Border.Style>
                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Margin="{StaticResource DefaultMargin}">                    
                    <TextBlock FontSize="{StaticResource SmallFontSize}" Text="Panel is frozen" VerticalAlignment="Center" />
                    <Canvas Margin="{StaticResource DefaultLeftMargin}" Width="16" Height="16" >
                        <Path Fill="#FF000000" Stretch="Uniform" Width="16" Height="16" Data="{StaticResource alertPathData}" VerticalAlignment="Bottom" />
                    </Canvas>
                </StackPanel>
            </Border>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>

                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>

                    </Grid.RowDefinitions>



                    <TextBlock FontSize="{StaticResource SmallFontSize}" HorizontalAlignment="Center" Text="Track" Style="{StaticResource Title}" Grid.ColumnSpan="3" />

                    <!-- Title -->
                    <TextBlock 
                        FontSize="{StaticResource SmallFontSize}"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Width="Auto"
                        Grid.Row="1"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Title" Style="{StaticResource Heading2}" />
                    <TextBox 
                        FontSize="{StaticResource SmallFontSize}"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        HorizontalAlignment="Left"
                        Width="{StaticResource text_width}"                  
                        Height="{StaticResource textbox_height}"
                        Text="{Binding SelectedModelTag.Title, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                        Grid.Row="1" Grid.Column="1" 
                    />
                    <CheckBox
                        Style="{StaticResource singleSelectionCheckbox}"
                        IsChecked="{Binding IncludeTitle, Mode=TwoWay}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        Grid.Row="1" Grid.Column="2" 
                    >

                    </CheckBox>

                    <!-- Position -->
                    <TextBlock 
                        VerticalAlignment="Center"
                        FontSize="{StaticResource SmallFontSize}"
                        Width="Auto"
                        HorizontalAlignment="Left"
                        Grid.Row="2"                    
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Position" Style="{StaticResource Heading2}" />
                    <TextBox 
                        FontSize="{StaticResource SmallFontSize}"
                        Height="{StaticResource textbox_height}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="30"                  
                        Text="{Binding SelectedModelTag.Position, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                        Grid.Row="2" Grid.Column="1" 
                    />
                    <CheckBox
                        Style="{StaticResource singleSelectionCheckbox}"
                        IsChecked="{Binding IncludePosition, Mode=TwoWay}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        Grid.Row="2" Grid.Column="2" 
                    />



                    <!-- Artists -->
                    <TextBlock                     
                        Grid.Row="3"
                        Width="Auto"
                        VerticalAlignment="Center"
                        FontSize="{StaticResource SmallFontSize}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Artists" Style="{StaticResource Heading2}" />
                    <TextBox       
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{Binding SelectedModelTag.TrackArtists, Converter={StaticResource arraysplitConverter}, Mode=TwoWay}" 
                        Grid.Column="1" Grid.Row="3"               
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"             
                        HorizontalAlignment="Left"
                        Height="20"
                    />
                    <CheckBox
                        IsChecked="{Binding IncludeTrackArtist, Mode=TwoWay}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        Grid.Row="3" Grid.Column="2" 
                    />

                    <!-- Genres -->
                    <TextBlock   
                        FontSize="{StaticResource SmallFontSize}"
                        Grid.Row="4"
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Genres" Style="{StaticResource Heading2}" />
                    <TextBox      
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{Binding SelectedModelTag.Genres, Mode=TwoWay, Converter={StaticResource arraysplitConverter}}" 
                        Grid.Row="4" Grid.Column="1" 
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"        
                        HorizontalAlignment="Left"
                        Height="{StaticResource textbox_height}"                        
                    />
                    <!--
                    <TextBox 
                        FontSize="{StaticResource SmallFontSize}"
                        Height="{StaticResource textbox_height}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"                  
                        Text="{Binding SelectedModelTag.Genres, Converter={StaticResource arraysplitConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                        Grid.Row="4" Grid.Column="1" 
                    />
                    -->
                    <CheckBox
                        IsChecked="{Binding IncludeGenres, Mode=TwoWay}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        Grid.Row="4" Grid.Column="2" 
                    />

                    <!-- MusicBrainzID -->
                    <TextBlock 
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="MbId" Style="{StaticResource Heading2}" 
                        FontSize="{StaticResource SmallFontSize}"
                        Grid.Row="5"
                    />
                    <TextBox 
                        Height="{StaticResource textbox_height}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"    
                        Text="{Binding SelectedModelTag.TrackMbid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        FontSize="{StaticResource SmallFontSize}"
                        Grid.Row="5" Grid.Column="1" />




                    <TextBlock FontSize="{StaticResource SmallFontSize}"  Grid.Row="6" Grid.ColumnSpan="3" HorizontalAlignment="Center" Text="Release" Style="{StaticResource Title}" />

                    <!-- Album -->
                    <TextBlock 
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Album" Style="{StaticResource Heading2}" 
                        FontSize="{StaticResource SmallFontSize}"
                        Grid.Row="7"
                    />
                    <TextBox      
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{Binding SelectedModelTag.Album, Mode=TwoWay}" 
                        Grid.Column="1" Grid.Row="7"               
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"        
                        HorizontalAlignment="Left"
                        Height="{StaticResource textbox_height}"
                    />
                    <CheckBox 
                        IsChecked="{Binding IncludeRelease, Mode=TwoWay}"
                        Grid.Column="2" Grid.Row="7"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        HorizontalAlignment="Left"
                        />

                    <!-- Artists -->
                    <TextBlock 
                        FontSize="{StaticResource SmallFontSize}"
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Artists" Style="{StaticResource Heading2}" 
                        Grid.Row="8"
                    />
                    <TextBox   
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{Binding SelectedModelTag.AlbumArtists, Converter={StaticResource arraysplitConverter}, Mode=TwoWay}" 
                        Grid.Column="1" Grid.Row="8"               
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"        
                        HorizontalAlignment="Left"
                        Height="{StaticResource textbox_height}"
                    />
                    <CheckBox 
                        IsChecked="{Binding IncludeReleaseArtist, Mode=TwoWay}"
                        Grid.Column="2" Grid.Row="8"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        HorizontalAlignment="Left"
                    />

                    <!-- Year -->
                    <TextBlock 
                        FontSize="{StaticResource SmallFontSize}"
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Year" Style="{StaticResource Heading2}" 
                        Grid.Row="9"
                    />
                    <TextBox 
                        FontSize="{StaticResource SmallFontSize}"
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"    
                        Text="{Binding SelectedModelTag.Year, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Height="{StaticResource textbox_height}"
                        Grid.Row="9" Grid.Column="1" />
                    <CheckBox 
                        IsChecked="{Binding IncludeYear, Mode=TwoWay}"
                        Grid.Column="2" Grid.Row="9"
                        Margin="{StaticResource DefaultTopLeftMargin}"
                        HorizontalAlignment="Left"
                    />


                    <!-- Release Mbid -->
                    <TextBlock 
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="MbId" Style="{StaticResource Heading2}" 
                        Grid.Row="10"
                        FontSize="{StaticResource SmallFontSize}"
                    />
                    <TextBox 
                        HorizontalAlignment="Left"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Width="{StaticResource text_width}"    
                        Text="{Binding SelectedModelTag.ReleaseMbid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        FontSize="{StaticResource SmallFontSize}"
                        Height="{StaticResource textbox_height}"
                        Grid.Row="10" Grid.Column="1" />

                    <!-- Picture -->
                    <TextBlock 
                        Width="Auto"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Margin="{StaticResource DefaultTopLeftMargin}" 
                        Text="Cover" Style="{StaticResource Heading2}" 
                        Grid.Row="11"
                        FontSize="{StaticResource SmallFontSize}"
                    />
                    <CheckBox 
                        HorizontalAlignment="Center" 
                        IsChecked="{Binding IncludePicture, Mode=TwoWay}" 
                        Grid.Row="11" Grid.Column="2"
                        Margin="{StaticResource DefaultTopLeftMargin}" />


                </Grid>



            </Grid>


            <!--<Grid VerticalAlignment="Top" HorizontalAlignment="Center" Margin="{StaticResource DefaultTopMargin}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Border 
                    Grid.ColumnSpan="3"                                
                    HorizontalAlignment="Center"
                    VerticalAlignment="Top"
                    Margin="{StaticResource DefaultTopMargin}"
                    BorderThickness="1"
                    MinWidth="64"
                    MinHeight="64"
                >
                    <Image                                               
                        MaxWidth="64" 
                        MaxHeight="64"             
                        Stretch="Uniform"                       
                        IsEnabled="{Binding IncludePicture}"
                        Source="{Binding SelectedModelTag.Picture, Converter={StaticResource imageConverter}}"
                    />
                </Border>
                
                <mui:ModernButton Grid.Row="1" Grid.Column="0" Margin="{StaticResource DefaultTopLeftMargin}" IconData="{StaticResource uploadPathData}" Command="{Binding ImportPictureCommand}" />
                <mui:ModernButton Grid.Row="1" Grid.Column="1" Margin="{StaticResource DefaultTopLeftMargin}" IconData="{StaticResource trashPathData}" Command="{Binding RemovePictureCommand}" />
                <mui:ModernButton Grid.Row="1" Grid.Column="2" Margin="{StaticResource DefaultTopLeftMargin}" IconData="{StaticResource downloadPathData}" Command="{Binding ExportPictureCommand}" />

            </Grid>-->

            <Grid VerticalAlignment="Top" HorizontalAlignment="Center" Margin="{StaticResource DefaultTopMargin}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Border 
                    Grid.RowSpan="3"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Top"
                    Margin="{StaticResource DefaultTopMargin}"
                    BorderThickness="1"
                    BorderBrush="{DynamicResource SeparatorBackground}"
                    MinWidth="{StaticResource cover_size}"
                    MinHeight="{StaticResource cover_size}"                        
                >
                    <Image                                           
                        MaxWidth="{StaticResource cover_size}" 
                        MaxHeight="{StaticResource cover_size}"             
                        Stretch="Uniform"                       
                        IsEnabled="{Binding IncludePicture}"
                        Source="{Binding SelectedModelTag.Picture, Converter={StaticResource imageConverter}}"
                    />
                </Border>

                <mui:ModernButton Grid.Row="0" Grid.Column="1" Margin="{StaticResource DefaultTopLeftMargin}" IconData="{StaticResource uploadPathData}" CommandParameter="{Binding SelectedModelTag}" Command="{Binding Source={x:Static provider:ViewModelLocator.Instance}, Path=TrackTagVM.ImportPictureCommand}" ToolTip="Import picture" />
                <mui:ModernButton Grid.Row="1" Grid.Column="1" Margin="{StaticResource DefaultTopLeftMargin}" IconData="{StaticResource trashPathData}" CommandParameter="{Binding SelectedModelTag}" Command="{Binding Source={x:Static provider:ViewModelLocator.Instance}, Path=TrackTagVM.RemovePictureCommand}" ToolTip="Remove picture" />
                <mui:ModernButton Grid.Row="2" Grid.Column="1" Margin="{StaticResource DefaultTopLeftMargin}" IconData="{StaticResource downloadPathData}" CommandParameter="{Binding SelectedModelTag}" Command="{Binding Source={x:Static provider:ViewModelLocator.Instance}, Path=TrackTagVM.ExportPictureCommand}" ToolTip="Export picture" />

            </Grid>

        </StackPanel>
    </ScrollViewer>
</UserControl>
